package com.ws.common.util;

import cn.hutool.core.util.ObjectUtil;

public class StringUtils {

	
	//下划线转大驼峰
	public static String camelMax(String str) {
		String []s=str.split("_");
		String resutl="";
		for(String p:s){
			resutl=resutl + p.substring(0,1).toUpperCase()+p.substring(1).toLowerCase();
		}
		return resutl;
	}

	//下划线转小驼峰
	public static String camelMin(String str) {
		String resutl=camelMax(str);
		return resutl.substring(0,1).toLowerCase()+resutl.substring(1);
	}
	public static String camelToUnderline(String str){
		String result="";
		for(Character c:str.toCharArray()){
			if('A'<=c && c<='Z'){
				if( !result.equals("")){
					result+="_";
				}
				result+=c.toString().toLowerCase();
			}else{
				result+=c;
			}
		}
		return result;
	}

	public static Boolean objectIsEmpty(Object o){
		if(ObjectUtil.isNull(o)){
			return true;
		}
		if(o instanceof String){
			if (o.toString().equals("")){
				return true;
			}
		}
		return false;
	}

	public static Boolean objectIsNotEmpty(Object o){
		return !objectIsEmpty(o);
	}
}
